From 0dd4565f4e6253fe098f7161ba259f75ee81c48a Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Wed, 6 Apr 2022 00:50:18 +0200
Subject: [PATCH 02/22] HACK: work around amdgcn omptarget cross-compiling
 issues

---
 openmp/libomptarget/DeviceRTL/CMakeLists.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/openmp/libomptarget/DeviceRTL/CMakeLists.txt b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
index ce6621482..c41617dea 100644
--- a/openmp/libomptarget/DeviceRTL/CMakeLists.txt
+++ b/openmp/libomptarget/DeviceRTL/CMakeLists.txt
@@ -24,7 +24,11 @@ if(NOT ${CMAKE_SIZEOF_VOID_P} EQUAL "8")
   return()
 endif()
 
-if (LLVM_DIR)
+if (CMAKE_CROSSCOMPILING)
+  set(CLANG_TOOL /usr/bin/clang)
+  set(LINK_TOOL /usr/bin/llvm-link)
+  set(OPT_TOOL /usr/bin/opt)
+elseif (LLVM_DIR)
   # Builds that use pre-installed LLVM have LLVM_DIR set.
   # A standalone or LLVM_ENABLE_RUNTIMES=openmp build takes this route
   find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
-- 
2.35.1

